<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        div {
            width: 400px;
            height: 250px;
            margin: 100px auto;
        }
    </style>
</head>

<body>
    <div>
        <input type="password"><span>请输入6~16位的密码</span>

    </div>

    <script>
        const inputOjb = document.querySelector("input")
        const spanOjb = document.querySelector("span")
        inputOjb.onblur = function () {
            // alert("jj")
            // console.log("skgjkl")
            console.log(inputOjb.innerText.length)
            
            if (inputOjb.innerText.length < 6 && inputOjb.innerText.length > 16) {
                spanOjb.innerText = "输入错误，要6~16"

            }
        }
    </script>
</body>

</html>